/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pa165.dominating.species.dao;

import java.util.List;
import pa165.dominating.species.entities.Animal;
import pa165.dominating.species.entities.Environment;

/**
 *
 * @author Filip Dinh
 */
public interface AnimalDAO {

    /**
     * Stores animal into database. Id for the new animal is automatically
     * generated and stored into id attribute.
     *
     * @param animal animal to be created.
     *
     */
    public void createAnimal(Animal animal);

    /**
     * Updates animal in database.
     *
     * @param animal updated animal to be stored into database.
     *
     */
    public void updateAnimal(Animal animal);

    /**
     * Deletes animal from database.
     *
     * @param animal animal to be deleted from db.
     *
     */
    public void deleteAnimal(Animal animal);

    /**
     * Returns list of all animals in the database.
     *
     * @return list of all animals in database.
     */
    public List<Animal> getAllAnimals();

    /**
     * Returns animal with given id.
     *
     * @param id primary key of requested animal.
     * @return animal with given id or null if such animal does not exist.
     */
    public Animal getAnimalById(Long id);

    /**
     * Returns animals that live in the given environment.
     *
     * @param environment
     * @return animals living in the given environment.
     */
    public List<Animal> getAnimalsByEnvironment(Environment environment);

    /**
     * @return number of animals in database.
     */
    public int getAnimalCount();

    /**
     * Puts given prey to the list of predator´s prey and puts given predator to
     * the list of prey´s predators.
     *
     * @param predator
     * @param prey
     *
     */
    public void addPreyToPredator(Animal predator, Animal prey);

    /**
     * Removes the given prey from list of given predator´s prey and removes the
     * predator from list of given prey´s predators.
     *
     * @param predator
     * @param prey
     *
     */
    public void removePreyOfPredator(Animal predator, Animal prey);

    /**
     * Returns all predators of given prey.
     *
     * @param prey
     * @return list of all predators of the prey.
     *
     */
    public List<Animal> getPredatorsOfPrey(Animal prey);

    /**
     * Returns all prey of given predator.
     *
     * @param predator
     * @return list of all prey of the predator.
     *
     */
    public List<Animal> getPreyOfPredator(Animal predator);
}